#pragma once

#include<iostream>
#include<string>
#include<unistd.h>
#include<cstring>
#include<cassert>
#include<sys/types.h>
#include<vector>
using namespace::std;
typedef void(*function)();
void PrintLog()
{
    cout << "子进程pid=:" << getpid() << " 正在打印日志！"<<endl;
}

void PrintNet()
{
    cout << "子进程pid=:" << getpid() <<" 正在进行网路请求"<<endl;
}

void PrintMysql()
{
    cout << "子进程pid=:" << getpid() <<" 正在进行数据库请求"<<endl;
}
class Task
{
public:
    Task()
    {
        funcs.push_back(PrintLog);
        funcs.push_back(PrintNet);
        funcs.push_back(PrintMysql);
    }
    ~Task()
    {
        ;
    }
    void execute(const int& command)
    {
        if(command >=0 && command < funcs.size())
        {
            funcs[command]();
        }
    }
    vector<function> funcs;
};
class End_terminal
{
public:
    End_terminal(const pid_t& son_pid,const int& write_fd)
    :_son_pid(son_pid)
    ,_write_fd(write_fd)
    {
        ;
    }
    pid_t _son_pid;
    int _write_fd;
};
